<?php
/**
* @file boardnewsmult_adm.php
* Admin Systemblock multiple boardnews
*
* @author PortaMx - Portal Management Extension
* @author Copyright 2008-2011 by PortaMx - http://portamx.com
* @Version: 1.0 RC4
* @Date: 23.02.2011
*/

if(!defined('PortaMx'))
	die('This file can\'t be run without PortaMx');

/**
* @class pmxc_boardnewsmult_adm
* Admin Systemblock multiple boardnews_adm
* @see boardnewsmult_adm.php
* @author Copyright by PortaMx - http://portamx.com
*/
class pmxc_boardnewsmult_adm extends PortaMxC_SystemAdminBlock
{
	/**
	* AdmBlock_init().
	* Setup caching.
	*/
	function pmxc_AdmBlock_init()
	{
		$this->block_classdef = PortaMx_getdefaultClass(true);	// extended classdef
		$this->can_cached = 1;		// enable caching
	}

	/**
	* AdmBlock_settings().
	* Setup the config vars and output the block settings.
	* Returns the css classes they are used.
	*/
	function pmxc_AdmBlock_settings()
	{
		global $context, $txt;

		// define the settings options
		echo '
					<td valign="top" style="padding:4px;">
						<input type="hidden" name="config[settings]" value="" />';

		// define numeric vars to check
		echo '
						<input type="hidden" name="check_num_vars[]" value="[config][settings][teaser], 40" />
						<input type="hidden" name="check_num_vars[]" value="[config][settings][rescale], 0" />';

		// show the settings screen
		echo '
						<div class="cat_bar catbg_grid">
							<h4 class="catbg catbg_grid"><span class="cat_left_title">'. sprintf($txt['pmx_blocks_settings_title'], $this->register_blocks[$this->cfg['blocktype']]['description']) .'</span></h4>
						</div>

						<div class="adm_input">
							<span>'. $txt['pmx_boardnews_boards'] .'</span>
							<select class="adm_w90" name="config[settings][board][]" size="7" multiple="multiple" >';

		$boards = !empty($this->cfg['config']['settings']['board']) ? $this->cfg['config']['settings']['board'] : array();
		foreach($this->smf_boards as $brd)
			echo '
								<option value="'. $brd['id'] .'"'. (in_array($brd['id'], $boards) ? ' selected="selected"' : '') .'>'. $brd['name'] .'</option>';

		echo '
							</select>
						</div>

						<div class="adm_input" style="min-height:20px; margin-top:4px;">
							<span class="adm_w80">'. $txt['pmx_boponews_page'] .'
								<img class="info_toggle" onclick=\'Show_help("pmxBNMH03")\' src="'. $context['pmx_imageurl'] .'information.gif" alt="*" title="'. $txt['pmx_information_icon'] .'" />
							</span>
							<div><input onkeyup="check_numeric(this);" size="2" type="text" name="config[settings][onpage]" value="' .(isset($this->cfg['config']['settings']['onpage']) ? $this->cfg['config']['settings']['onpage'] : ''). '" /></div>
							<div id="pmxBNMH03" class="info_frame" style="margin-top:2px;">'. $txt['pmx_pageindex_help'] .'</div>
						</div>

						<div class="adm_check" style="min-height:20px;">
							<span class="adm_w80">'. $txt['pmx_pageindex_pagetop'] .'
								<img class="info_toggle" onclick=\'Show_help("pmxBNMH04")\' src="'. $context['pmx_imageurl'] .'information.gif" alt="*" title="'. $txt['pmx_information_icon'] .'" />
							</span>
							<input type="hidden" name="config[settings][pgidxtop]" value="0" />
							<div><input class="input_check" type="checkbox" name="config[settings][pgidxtop]" value="1"' .(isset($this->cfg['config']['settings']['pgidxtop']) && !empty($this->cfg['config']['settings']['pgidxtop']) ? ' checked="checked"' : ''). ' /></div>
							<div id="pmxBNMH04" class="info_frame" style="margin-top:4px;">'. $txt['pmx_pageindex_tophelp'] .'</div>
						</div>

						<div class="adm_input" style="height:20px;">
							<span class="adm_w80">'. sprintf($txt['pmx_adm_teaser'], $txt['pmx_teasemode'][intval(!empty($context['pmx']['settings']['teasermode']))]) .'
								<img class="info_toggle" onclick=\'Show_help("pmxBNMH01")\' src="'. $context['pmx_imageurl'] .'information.gif" alt="*" title="'. $txt['pmx_information_icon'] .'" />
							</span>
							<div><input onkeyup="check_numeric(this);" size="3" type="text" name="config[settings][teaser]" value="' .(isset($this->cfg['config']['settings']['teaser']) ? $this->cfg['config']['settings']['teaser'] : '40'). '" /></div>
						</div>
						<div id="pmxBNMH01" class="info_frame" style="margin-top:4px;">'. $txt['pmx_adm_teasehelp'] .'</div>

						<div class="adm_input" style="height:20px;">
							<span class="adm_w80">'. $txt['pmx_boponews_rescale'] .'
								<img class="info_toggle" onclick=\'Show_help("pmxBNMH02")\' src="'. $context['pmx_imageurl'] .'information.gif" alt="*" title="'. $txt['pmx_information_icon'] .'" />
							</span>
							<div><input onkeyup="check_numeric(this);" size="3" type="text" name="config[settings][rescale]" value="' .(isset($this->cfg['config']['settings']['rescale']) ? $this->cfg['config']['settings']['rescale'] : '0'). '" /></div>
						</div>
						<div id="pmxBNMH02" class="info_frame" style="margin-top:4px;">'. $txt['pmx_boponews_rescalehelp'] .'</div>

						<div class="adm_check" style="height:20px;">
							<span class="adm_w80">'. $txt['pmx_boponews_showthumbs'] .'</span>
							<input type="hidden" name="config[settings][thumbs]" value="0" />
							<div><input class="input_check" type="checkbox" name="config[settings][thumbs]" value="1"' .(isset($this->cfg['config']['settings']['thumbs']) && !empty($this->cfg['config']['settings']['thumbs']) ? ' checked="checked"' : ''). ' /></div>
						</div>

						<div class="adm_check" style="height:20px;">
							<span class="adm_w80">'. $txt['pmx_boponews_split'] .'</span>
							<input type="hidden" name="config[settings][split]" value="0" />
							<div><input class="input_check" type="checkbox" name="config[settings][split]" value="1"' .(isset($this->cfg['config']['settings']['split']) && !empty($this->cfg['config']['settings']['split']) ? ' checked="checked"' : ''). ' /></div>
						</div>

						<div class="adm_check" style="height:20px;">
							<span class="adm_w80">'. $txt['pmx_boponews_equal'] .'</span>
							<input type="hidden" name="config[settings][equal]" value="0" />
							<div><input class="input_check" type="checkbox" name="config[settings][equal]" value="1"' .(isset($this->cfg['config']['settings']['equal']) && !empty($this->cfg['config']['settings']['equal']) ? ' checked="checked"' : ''). ' /></div>
						</div>';

		if(empty($context['pmx']['settings']['disableHS']))
			echo '
						<div class="adm_check" style="height:20px;">
							<span class="adm_w80">'. $txt['pmx_boponews_disableHS'] .'</span>
							<input type="hidden" name="config[settings][disableHS]" value="0" />
							<div><input class="input_check" type="checkbox" name="config[settings][disableHS]" value="1"' .(isset($this->cfg['config']['settings']['disableHS']) && !empty($this->cfg['config']['settings']['disableHS']) ? ' checked="checked"' : ''). ' /></div>
						</div>';

		// return the used classnames
		return $this->block_classdef;
	}
}
?>
